package vo

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

type R struct {
	Data    interface{} `json:"data"`
	Message string      `json:"message"`
	Status  int64       `json:"status"`
}

func OK(data interface{}, message string, status int64, c *gin.Context) {
	r := &R{
		Data:    data,
		Message: message,
		Status:  status,
	}
	c.JSON(http.StatusOK, gin.H{
		"result": r,
	})
}

func FAIL(data interface{}, message string, status int64, c *gin.Context) {
	r := &R{
		Data:    data,
		Message: message,
		Status:  status,
	}
	c.JSON(http.StatusInternalServerError, gin.H{
		"result": r,
	})
}
